package b2.player
{
	import b2.config.*;
	
	public class TaskPackage
	{
		//任务清单（索引: 任务唯一号; 值: 任务状态）
		public var taskList:Object;
		
		public function TaskPackage(packageXML:XML = null)
		{
			taskList = new Object();
			if (packageXML != null)
			{
				for (var i:int = 0; i < packageXML.task.length(); i++)
				{
					var taskIndex:int = packageXML.task[i].taskIndex;
					var taskStatus:int = packageXML.task[i].taskStatus;
					taskList[taskIndex] = taskStatus;
				}
			}
		}
		
		public function getOnGoingTasks(taskType:int):Array
		{
			var taskIndexes:Array = new Array();
			for (var taskIndex:String in taskList)
			{
				var status:int = taskList[taskIndex];
				var taskConfig:TaskConfig = Config.taskConfigs[taskIndex];
				if (status == 0 && taskConfig.type == taskType)
				{
					taskIndexes.push(taskIndex);
				}
			}
			return taskIndexes;
		}
		
	}
}